//请求测试
import request from "../untils/request";

export const getTestMock = () => {
  return request({
    method: "GET",
    url: "/news/article",
  });
};

// 导航列表接口
export const getNavList = () => {
  return request({
    method: "GET",
    url: "/nav/navList",
  });
};

// 获取指数信息
export const getQuotes = (params) => {
  return request({
    method: "GET",
    url: "/quote",
    //  params选项是用来配置GET方法的query参数，?xxx=xxx&key=value
    params,
  });
};

//获取热帖数据
export const getArticles = (params) => {
  return request({
    method: "GET",
    url: "/articles",
    //  params选项是用来配置GET方法的query参数，?page=1
    params,
  });
};

// 获取当日股票排行榜
// type=0,1,2,3分别获取全球、沪深、港股、美股
export const getStocks = (params) => {
  return request({
    method: "GET",
    url: "/stocks",
    // type=1,2,3,4
    params,
  });
};

// 获取基金板块banner轮播图
export const getFundBanner = () => {
  return request({
    method: "GET",
    url: "/fund/banner",
  });
};

// 获取基金板块的tablist列表
export const getFundTablist = () => {
  return request({
    method: "GET",
    url: "/fund/tablist",
  });
};

// 登录接口，提交账号和密码到服务器
export const postLogin = (data) => {
  return request({
    method: "POST",
    url: "/login",
    data,
  });
};

// 获取验证码
export const getCode = (params) => {
  return request({
    method: "get",
    url: "/code",
    params,
  });
};

// 获取评论
export const getArticleComments = (params) => {
  return request({
    method: "GET",
    url: "/article/comments",
    params,
  });
};

// 提交评论
export const postArticleComment = (data) => {
  return request({
    method: "POST",
    url: "/article/comments/pub",
    data,
  });
};